import org.omg.CORBA.Bounds;

import javax.swing.*;
import java.util.Random;

public class test3 {
    public static void main(String[] args) {
        //打乱数组顺序
        int[] arr = {1,2,3,4,5};
        //索引范围 0 1 2 3 4
        Random r = new Random();

        //利用循环去打乱顺序
        for (int i = 0; i < arr.length; i++) {
            int number = r.nextInt(arr.length);
            //交换
            int temp = arr[i];
            arr[i] = arr[number];
            arr[number] = temp;
        }

        //打印输出
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
